package userstub

import (
	"log"
	"net/rpc"
)

type UserStub struct {
	Client *rpc.Client
}

var Stub *UserStub

func InitStub(address string) {
	Stub = &UserStub{Client: NewClient(address)}
}

func NewClient(str string) *rpc.Client {
	client, err := rpc.Dial("tcp", str)
	if err != nil {
		log.Fatal("dialing: ", err)
	}
	return client
}
